package com.wang.service;


import com.wang.mapper.DeviceDao;
import com.wang.pojo.Device;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
@Transactional
public class DeviceServiceImpl implements DeviceService {

    @Autowired
    private DeviceDao deviceDao;


    @Override
    public void updateDevStatusCode(String devGId, String devStatus) {
        deviceDao.updateDevStatusCode(devGId, devStatus);
    }


    @Override
    public void setSocketDevOffLine(String devStatus) {
        deviceDao.setSocketDevOffLine(devStatus);
    }

    @Override
    public List<Device> selectJSONSocketDev(String devTxTypeCode, String devDataTypeCode) {
        return deviceDao.selectJSONSocketDev(devTxTypeCode, devDataTypeCode);
    }

    @Override
    public List<Device> selectModbusSocketDev(String devTxTypeCode, String devDataTypeCode) {
        return deviceDao.selectModbusSocketDev(devTxTypeCode, devDataTypeCode);
    }

    @Override
    public Device selectDeviceByDevGId(String devGId) {
        return deviceDao.selectDeviceByDevGId(devGId);
    }

    @Override
    public Device selectDeviceByDevId(Integer devId) {
        return deviceDao.selectDeviceByDevId(devId);
    }

    @Override
    public void updateDevOnlineData(Integer devId, String devStatusCode, String lastOnlineTime, String totalOfflineTime) {
        deviceDao.updateDevOnlineData(devId, devStatusCode, lastOnlineTime, totalOfflineTime);
    }

    @Override
    public void updateDevOfflineData(Integer devId, String devStatusCode, String lastOffLineTime, String totalOnlineTime) {
        deviceDao.updateDevOfflineData(devId, devStatusCode, lastOffLineTime, totalOnlineTime);
    }

    @Override
    public List<Device> selectDevByDevStatus(String devStatusCode) {
        return deviceDao.selectDevByDevStatus(devStatusCode);
    }

    @Override
    public List<Device> selectCustom1SocketDev(String socketTxCode, String customOneCode) {
        return deviceDao.selectCustom1SocketDev(socketTxCode,customOneCode);
    }

    @Override
    public List<Device> selectByFlagConf(String flagConf) {
        return deviceDao.selectByFlagConf(flagConf);
    }

    @Override
    public List<Device> selectCustom2SocketDev(String socketTxCode, String customTWOCode) {
        return deviceDao.selectCustom2SocketDev(socketTxCode,customTWOCode);
    }
}
